<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Rules extends CI_Controller {

		function __construct()
	{
		parent::__construct();
		$this->load->library('ion_auth');
		$this->load->library('session');
		$this->load->database();
		$this->load->helper(array('url','language'));
    $this->lang->load('general');
    $this->load->model(array('points_model', 'stages_model', 'riders_model'));
    $this->data['user'] = $this->ion_auth->user()->row();
	}

  function index()
  {

    $config_array = $this->config_model->get_all();

    foreach ($config_array as $item) 
    {
      $this->data['config'][$item['name']] = $item['value'];
    }

    $this->data['config']['points_stage'] = explode(',',$this->data['config']['points_stage']);
    $this->data['config']['points_stage_yellow'] = explode(',',$this->data['config']['points_stage_yellow']);
    $this->data['config']['points_stage_green'] = explode(',',$this->data['config']['points_stage_green']);
    $this->data['config']['points_stage_mountain'] = explode(',',$this->data['config']['points_stage_mountain']);
    $this->data['config']['points_end_yellow'] = explode(',',$this->data['config']['points_end_yellow']);
    $this->data['config']['points_end_green'] = explode(',',$this->data['config']['points_end_green']);
    $this->data['config']['points_end_mountain'] = explode(',',$this->data['config']['points_end_mountain']);   
    // echo "<pre>";
    // print_r($this->data['config']);
    // echo "</pre>";


    $this->data['title'] = lang('the_rules');
    $this->data['view'] = 'rules/index';
    $this->load->view('template', $this->data);

  }

}

/* End of file rules.php */
/* Location: ./application/controllers/rules.php */